package com.chcplayer
{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.filesystem.File;

/**
 * author yh
 */
public class FileListModel extends EventDispatcher
{
	/**
	 */
	private var m_strDocPath:String = "";
	/**
	 */
	private var m_obAppModel:ChcPlayerAppModel;
	/**
	 */
	private var m_obFileModel:ChcFileModel;
	/**
	 */
	public function FileListModel(target:IEventDispatcher=null)
	{
		super(target);
	}
//==================================================================================================
// public
//==================================================================================================
	/**
	 */
	public function createNewFile():void
	{
		m_strDocPath = "未标题";
		m_obAppModel.setEditMode(true);
		m_obFileModel.createNewFile();
	}
	/**
	 */
	public function closeFile():void
	{
		m_strDocPath = "未标题";
		m_obFileModel.createNewFile();
	}
	/**
	 */
	public function openFile(fi:File):void
	{
		m_strDocPath = fi.nativePath;
		m_obAppModel.setEditMode(false);
		m_obFileModel.openFile(fi);
	}
	/**
	 */
	public function setModel(obM:ChcFileModel, obAM:ChcPlayerAppModel):void
	{
		m_obFileModel = obM;
		m_obAppModel = obAM;
	}
	/**
	 */
	public function getDocPath():String
	{
		return m_strDocPath;
	}
}
}